home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / CIncludes / QD3DController.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-12  |  10.8 KB  |  358 lines  |  [TEXT/MPS ]

  1. /******************************************************************************
  2.  **                                                                             **
  3.  **     Module:        QD3DController.h                                         **
  4.  **                                                                          **
  5.  **                                                                          **
  6.  **     Purpose:     Each physical device is represented in the system by a     **
  7.  **                 Controller record.  A device driver typically creates     **
  8.  **                 a controller.  Controller feeds changes in coordinates     **
  9.  **                 to a Tracker.                                             **
  10.  **                                                                          **
  11.  **                                                                          **
  12.  **                                                                          **
  13.  **     Copyright (C) 1992-1997 Apple Computer, Inc.  All rights reserved.     **
  14.  **                                                                          **
  15.  **                                                                          **
  16.  *****************************************************************************/
  17. #ifndef QD3DController_h
  18. #define QD3DController_h
  19.  
  20. #include "QD3D.h"
  21.  
  22. #if defined(PRAGMA_ONCE) && PRAGMA_ONCE
  23.     #pragma once
  24. #endif  /*  PRAGMA_ONCE  */
  25.  
  26. #if defined(OS_MACINTOSH) && OS_MACINTOSH
  27.  
  28. #if defined(__xlc__) || defined(__XLC121__)
  29.     #pragma options enum=int
  30.     #pragma options align=power
  31. #elif defined(__MWERKS__)
  32.     #pragma enumsalwaysint on
  33.     #pragma options align=native
  34. #elif defined(__MRC__) || defined(__SC__)
  35.     #if __option(pack_enums)
  36.         #define PRAGMA_ENUM_RESET_QD3DCONTROL 1
  37.     #endif
  38.     #pragma options(!pack_enums)
  39.     #pragma options align=power
  40. #endif
  41.  
  42. #endif  /* OS_MACINTOSH */
  43.  
  44.  
  45. #ifdef __cplusplus
  46. extern "C" {
  47. #endif  /*  __cplusplus  */
  48.  
  49.  
  50. /******************************************************************************
  51.  **                                                                             **
  52.  **                                Type Definitions                             **
  53.  **                                                                             **
  54.  *****************************************************************************/
  55.  
  56. #define kQ3ControllerSetChannelMaxDataSize        256
  57.  
  58. typedef TQ3Status (QD3D_CALLBACK *TQ3ChannelGetMethod) (
  59.     TQ3ControllerRef            controllerRef,
  60.     unsigned long                channel,
  61.     void                        *data,
  62.     unsigned long                *dataSize);
  63.  
  64. typedef TQ3Status (QD3D_CALLBACK *TQ3ChannelSetMethod) (
  65.     TQ3ControllerRef            controllerRef,
  66.     unsigned long                channel,
  67.     const void                    *data,
  68.     unsigned long                dataSize);
  69.  
  70. typedef struct TQ3ControllerData {
  71.     char                        *signature;
  72.     unsigned long                valueCount;
  73.     unsigned long                channelCount;
  74.     TQ3ChannelGetMethod            channelGetMethod;
  75.     TQ3ChannelSetMethod            channelSetMethod;
  76. } TQ3ControllerData;
  77.  
  78.  
  79. /******************************************************************************
  80.  **                                                                             **
  81.  **                                     Routines                                 **
  82.  **                                                                             **
  83.  *****************************************************************************/
  84.  
  85. QD3D_EXPORT TQ3Status QD3D_CALL Q3Controller_GetListChanged (
  86.     TQ3Boolean                    *listChanged,
  87.     unsigned long                *serialNumber);
  88.  
  89. QD3D_EXPORT TQ3Status QD3D_CALL Q3Controller_Next(
  90.     TQ3ControllerRef            controllerRef,
  91.     TQ3ControllerRef            *nextControllerRef);
  92.  
  93. QD3D_EXPORT TQ3ControllerRef QD3D_CALL Q3Controller_New(
  94.     const TQ3ControllerData        *controllerData);
  95.  
  96. QD3D_EXPORT TQ3Status QD3D_CALL Q3Controller_Decommission(
  97.     TQ3ControllerRef            controllerRef);
  98.  
  99. QD3D_EXPORT TQ3Status QD3D_CALL Q3Controller_SetActivation(
  100.     TQ3ControllerRef            controllerRef,
  101.     TQ3Boolean                    active);
  102.  
  103. QD3D_EXPORT TQ3Status QD3D_CALL Q3Controller_GetActivation(
  104.     TQ3ControllerRef            controllerRef,
  105.     TQ3Boolean                    *active);
  106.  
  107. QD3D_EXPORT TQ3Status QD3D_CALL Q3Controller_GetSignature(
  108.     TQ3ControllerRef            controllerRef,
  109.     char                        *signature,
  110.     unsigned long                numChars);
  111.  
  112. QD3D_EXPORT TQ3Status QD3D_CALL Q3Controller_SetChannel(
  113.     TQ3ControllerRef            controllerRef,
  114.     unsigned long                channel,
  115.     const void                    *data,
  116.     unsigned long                dataSize);
  117.  
  118. QD3D_EXPORT TQ3Status QD3D_CALL Q3Controller_GetChannel(
  119.     TQ3ControllerRef            controllerRef,
  120.     unsigned long                channel,
  121.     void                        *data,
  122.     unsigned long                *dataSize);
  123.  
  124. QD3D_EXPORT TQ3Status QD3D_CALL Q3Controller_GetValueCount(
  125.     TQ3ControllerRef            controllerRef,
  126.     unsigned long                *valueCount);
  127.  
  128. QD3D_EXPORT TQ3Status QD3D_CALL Q3Controller_SetTracker(
  129.     TQ3ControllerRef            controllerRef,
  130.     TQ3TrackerObject            tracker);
  131.  
  132. QD3D_EXPORT TQ3Status QD3D_CALL Q3Controller_HasTracker(
  133.     TQ3ControllerRef            controllerRef,
  134.     TQ3Boolean                    *hasTracker);
  135.  
  136. QD3D_EXPORT TQ3Status QD3D_CALL Q3Controller_Track2DCursor(
  137.     TQ3ControllerRef            controllerRef,
  138.     TQ3Boolean                    *track2DCursor);
  139.  
  140. QD3D_EXPORT TQ3Status QD3D_CALL Q3Controller_Track3DCursor(
  141.     TQ3ControllerRef            controllerRef,
  142.     TQ3Boolean                    *track3DCursor);
  143.  
  144. QD3D_EXPORT TQ3Status QD3D_CALL Q3Controller_GetButtons(
  145.     TQ3ControllerRef            controllerRef,
  146.     unsigned long                *buttons);
  147.  
  148. QD3D_EXPORT TQ3Status QD3D_CALL Q3Controller_SetButtons(
  149.     TQ3ControllerRef            controllerRef,
  150.     unsigned long                buttons);
  151.  
  152. QD3D_EXPORT TQ3Status QD3D_CALL Q3Controller_GetTrackerPosition(
  153.     TQ3ControllerRef            controllerRef,
  154.     TQ3Point3D                    *position);
  155.  
  156. QD3D_EXPORT TQ3Status QD3D_CALL Q3Controller_SetTrackerPosition(
  157.     TQ3ControllerRef            controllerRef,
  158.     const TQ3Point3D            *position);
  159.  
  160. QD3D_EXPORT TQ3Status QD3D_CALL Q3Controller_MoveTrackerPosition(
  161.     TQ3ControllerRef            controllerRef,
  162.     const TQ3Vector3D            *delta);
  163.  
  164. QD3D_EXPORT TQ3Status QD3D_CALL Q3Controller_GetTrackerOrientation(
  165.     TQ3ControllerRef            controllerRef,
  166.     TQ3Quaternion                *orientation);
  167.  
  168. QD3D_EXPORT TQ3Status QD3D_CALL Q3Controller_SetTrackerOrientation(
  169.     TQ3ControllerRef            controllerRef,
  170.     const TQ3Quaternion            *orientation);
  171.  
  172. QD3D_EXPORT TQ3Status QD3D_CALL Q3Controller_MoveTrackerOrientation(
  173.     TQ3ControllerRef            controllerRef,
  174.     const TQ3Quaternion            *delta);
  175.  
  176. QD3D_EXPORT TQ3Status QD3D_CALL Q3Controller_GetValues(
  177.     TQ3ControllerRef            controllerRef,
  178.     unsigned long                valueCount,
  179.     float                        *values,
  180.     TQ3Boolean                    *changed,
  181.     unsigned long                *serialNumber);
  182.  
  183. QD3D_EXPORT TQ3Status QD3D_CALL Q3Controller_SetValues(
  184.     TQ3ControllerRef            controllerRef,
  185.     const float                    *values,
  186.     unsigned long                valueCount);
  187.  
  188.  
  189. /******************************************************************************
  190.  **                                                                             **
  191.  **                                 Routines                                     **
  192.  **                                                                             **
  193.  *****************************************************************************/
  194.  
  195. QD3D_EXPORT TQ3ControllerStateObject QD3D_CALL Q3ControllerState_New(
  196.     TQ3ControllerRef            controllerRef);
  197.  
  198. QD3D_EXPORT TQ3Status QD3D_CALL Q3ControllerState_SaveAndReset(
  199.     TQ3ControllerStateObject    controllerStateObject);
  200.  
  201. QD3D_EXPORT TQ3Status QD3D_CALL Q3ControllerState_Restore(
  202.     TQ3ControllerStateObject    controllerStateObject);
  203.  
  204.  
  205. /******************************************************************************
  206.  **                                                                             **
  207.  **                            Type Definitions                                 **
  208.  **                                                                             **
  209.  *****************************************************************************/
  210.  
  211. typedef TQ3Status (QD3D_CALLBACK *TQ3TrackerNotifyFunc) (
  212.     TQ3TrackerObject            trackerObject,
  213.     TQ3ControllerRef            controllerRef);
  214.  
  215.  
  216. /******************************************************************************
  217.  **                                                                             **
  218.  **                                 Routines                                     **
  219.  **                                                                             **
  220.  *****************************************************************************/
  221.  
  222. QD3D_EXPORT TQ3TrackerObject QD3D_CALL Q3Tracker_New(
  223.     TQ3TrackerNotifyFunc        notifyFunc);
  224.  
  225. QD3D_EXPORT TQ3Status QD3D_CALL Q3Tracker_SetNotifyThresholds(
  226.     TQ3TrackerObject            trackerObject,
  227.     float                        positionThresh,
  228.     float                        orientationThresh);
  229.  
  230. QD3D_EXPORT TQ3Status QD3D_CALL Q3Tracker_GetNotifyThresholds(
  231.     TQ3TrackerObject            trackerObject,
  232.     float                        *positionThresh,
  233.     float                        *orientationThresh);
  234.  
  235. QD3D_EXPORT TQ3Status QD3D_CALL Q3Tracker_SetActivation (
  236.     TQ3TrackerObject            trackerObject,
  237.     TQ3Boolean                    active);
  238.  
  239. QD3D_EXPORT TQ3Status QD3D_CALL Q3Tracker_GetActivation (
  240.     TQ3TrackerObject            trackerObject,
  241.     TQ3Boolean                    *active);
  242.  
  243. QD3D_EXPORT TQ3Status QD3D_CALL Q3Tracker_GetButtons(
  244.     TQ3TrackerObject            trackerObject,
  245.     unsigned long                *buttons);
  246.  
  247. QD3D_EXPORT TQ3Status QD3D_CALL Q3Tracker_ChangeButtons(
  248.     TQ3TrackerObject            trackerObject,
  249.     TQ3ControllerRef            controllerRef,
  250.     unsigned long                buttons,
  251.     unsigned long                buttonMask);
  252.  
  253. QD3D_EXPORT TQ3Status QD3D_CALL Q3Tracker_GetPosition(
  254.     TQ3TrackerObject            trackerObject,
  255.     TQ3Point3D                    *position,
  256.     TQ3Vector3D                    *delta,
  257.     TQ3Boolean                    *changed,
  258.     unsigned long                *serialNumber);
  259.  
  260. QD3D_EXPORT TQ3Status QD3D_CALL Q3Tracker_SetPosition(
  261.     TQ3TrackerObject            trackerObject,
  262.     TQ3ControllerRef            controllerRef,
  263.     const TQ3Point3D            *position);
  264.  
  265. QD3D_EXPORT TQ3Status QD3D_CALL Q3Tracker_MovePosition(
  266.     TQ3TrackerObject            trackerObject,
  267.     TQ3ControllerRef            controllerRef,
  268.     const TQ3Vector3D            *delta);
  269.  
  270. QD3D_EXPORT TQ3Status QD3D_CALL Q3Tracker_GetOrientation(
  271.     TQ3TrackerObject            trackerObject,
  272.     TQ3Quaternion                *orientation,
  273.     TQ3Quaternion                *delta,
  274.     TQ3Boolean                    *changed,
  275.     unsigned long                *serialNumber);
  276.  
  277. QD3D_EXPORT TQ3Status QD3D_CALL Q3Tracker_SetOrientation(
  278.     TQ3TrackerObject            trackerObject,
  279.     TQ3ControllerRef            controllerRef,
  280.     const TQ3Quaternion            *orientation);
  281.  
  282. QD3D_EXPORT TQ3Status QD3D_CALL Q3Tracker_MoveOrientation(
  283.     TQ3TrackerObject            trackerObject,
  284.     TQ3ControllerRef            controllerRef,
  285.     const TQ3Quaternion            *delta);
  286.  
  287. QD3D_EXPORT TQ3Status QD3D_CALL Q3Tracker_SetEventCoordinates(
  288.     TQ3TrackerObject            trackerObject,
  289.     unsigned long                timeStamp,
  290.     unsigned long                buttons,
  291.     const TQ3Point3D            *position,
  292.     const TQ3Quaternion            *orientation);
  293.  
  294. QD3D_EXPORT TQ3Status QD3D_CALL Q3Tracker_GetEventCoordinates(
  295.     TQ3TrackerObject            trackerObject,
  296.     unsigned long                timeStamp,
  297.     unsigned long                *buttons,
  298.     TQ3Point3D                    *position,
  299.     TQ3Quaternion                *orientation);
  300.  
  301.  
  302. /******************************************************************************
  303.  **                                                                             **
  304.  **                                 Types                                         **
  305.  **                                                                             **
  306.  *****************************************************************************/
  307.  
  308. typedef void (QD3D_CALLBACK *TQ3CursorTrackerNotifyFunc) (void);
  309.  
  310. /******************************************************************************
  311.  **                                                                             **
  312.  **                                 Routines                                     **
  313.  **                                                                             **
  314.  *****************************************************************************/
  315.  
  316. QD3D_EXPORT TQ3Status QD3D_CALL Q3CursorTracker_PrepareTracking(
  317.     void);
  318.  
  319. QD3D_EXPORT TQ3Status QD3D_CALL Q3CursorTracker_SetTrackDeltas(
  320.     TQ3Boolean                    trackDeltas);
  321.  
  322. QD3D_EXPORT TQ3Status QD3D_CALL Q3CursorTracker_GetAndClearDeltas(
  323.     float                        *depth,
  324.     TQ3Quaternion                *orientation,
  325.     TQ3Boolean                    *hasOrientation,
  326.     TQ3Boolean                    *changed,
  327.     unsigned long                *serialNumber);
  328.  
  329. QD3D_EXPORT TQ3Status QD3D_CALL Q3CursorTracker_SetNotifyFunc(
  330.     TQ3CursorTrackerNotifyFunc    notifyFunc);
  331.  
  332. QD3D_EXPORT TQ3Status QD3D_CALL Q3CursorTracker_GetNotifyFunc(
  333.     TQ3CursorTrackerNotifyFunc    *notifyFunc);
  334.     
  335. #ifdef __cplusplus
  336. }
  337. #endif  /*  __cplusplus  */
  338.  
  339. #if defined(OS_MACINTOSH) && OS_MACINTOSH
  340.  
  341. #if defined(__xlc__) || defined(__XLC121__)
  342.     #pragma options enum=reset
  343.     #pragma options align=reset
  344. #elif defined(__MWERKS__)
  345.     #pragma enumsalwaysint reset
  346.     #pragma options align=reset
  347. #elif defined(__MRC__) || defined(__SC__)
  348.     #if PRAGMA_ENUM_RESET_QD3DCONTROL
  349.         #pragma options(pack_enums)
  350.         #undef PRAGMA_ENUM_RESET_QD3DCONTROL
  351.     #endif
  352.     #pragma options align=reset
  353. #endif
  354.  
  355. #endif  /* OS_MACINTOSH */
  356.  
  357. #endif  /*  QD3DController_h  */
  358.